SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

Alter  trigger tfb_oldfixedassets_ad on dbo.tfb_oldfixedassets 
after delete 
as
  declare @old_statusid integer;
  declare @old_deprmethodid integer;
  declare @old_deproption integer;
  declare @old_planusemonth integer;
  declare @old_sumusedmonth integer;
  declare @old_planworkvalue decimal (18,2);
  declare @old_sumworkedvalue decimal (18,2);
  declare @old_rawamt decimal (18,2);
  declare @old_sumdepramt decimal (18,2);
  declare @old_remainamt decimal (18,2);
  declare @old_remainrate decimal (18,8);
  declare @old_monthdepramt decimal (18,2);
  declare @old_monthdeprrate decimal (18,8);
  declare @old_fixedassetid integer
begin
  set nocount on
  select @old_statusid=statusid,
         @old_deprmethodid=deprmethodid,
         @old_deproption=deproption,
         @old_planusemonth=planusemonth,
         @old_sumusedmonth=sumusedmonth,
         @old_planworkvalue=planworkvalue,
         @old_sumworkedvalue=sumworkedvalue,
         @old_rawamt=rawamt,
         @old_sumdepramt=sumdepramt,
         @old_remainamt=remainamt,
         @old_remainrate=remainrate,
         @old_monthdepramt=monthdepramt,
         @old_monthdeprrate=monthdeprrate,
         @old_fixedassetid=fixedassetid
from deleted

  update tfb_fixedassets set
  statusid = @old_statusid,
  deprmethodid = @old_deprmethodid,
  deproption = @old_deproption,
  planusemonth = @old_planusemonth,
  sumusedmonth = @old_sumusedmonth,
  planworkvalue = @old_planworkvalue,
  sumworkedvalue = @old_sumworkedvalue,
  rawamt = @old_rawamt,
  sumdepramt = @old_sumdepramt,
  remainamt = @old_remainamt,
  remainrate = @old_remainrate,
  monthdepramt = @old_monthdepramt,
  monthdeprrate = @old_monthdeprrate
  where tfb_fixedassets.fixedassetid = @old_fixedassetid;
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

